package org.brisling.docManage.queryService;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.brisling.base.service.AbstractBaseQueryService;
import org.brisling.common.ConstSysParam;
import org.brisling.docManage.domain.Docdetail;
import org.brisling.sysman.queryService.QueryDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/portletresource/query")
public class QueryResourceService extends AbstractBaseQueryService<Docdetail>{
	
	
	
	@SuppressWarnings("unused")
	@Autowired
	private QueryDictionaryService dicService;
	
	
	
	public QueryResourceService(){
		this.subSystem = ConstSysParam.SUBSYSTEM_DOCUMENT;
		
		this.tableName = ConstSysParam.VIEW_PREFIX+this.getTableName(Docdetail.class);
		this.clazz = Docdetail.class;
		
		
		orderMap.put("createtime","desc");			
		typeMap = this.getTypeMap(clazz);
		
	}
	
	@PersistenceContext(unitName=ConstSysParam.SUBSYSTEM_SYSMAN)
	@Autowired
	protected void setEntityManager(EntityManager entityManager){
		this.entityManager = entityManager;		
	}
	
	@RequestMapping("/mainPage.action")
	public ModelAndView getMainPage(){
		return this.getBizMainPage();
	}
	
	/* (non-Javadoc)
	 * @see org.brisling.service.sysman.DepartmentServiceInf#getEditPage()
	 */
	@RequestMapping("/editPage.action")
	public ModelAndView getEditPage(){
		return this.getBizEditPage();
	}	
	
	
		
	
	@RequestMapping("/getOne.action")
	public Docdetail getOne(@RequestParam(value="id",required=false) Long id){
		return super.getOne(id);
	}
	
	
	

}
